<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页案例</title>
    <link rel="shortcut icon" href="/images/index/logo.ico">
    <style>
        .refresh {
            display: inline-block;
            float: right;
        }

        .form-group {
            margin-bottom: 35px;
        }

    </style>
</head>
<body>


<div class="refresh">
    <button class="btn btn-info search" title="刷新" data-url="/indexCase/admin/addIndex"><span
            class="glyphicon glyphicon-refresh"></span></button>
</div>
<div class="">
    <ol class="breadcrumb">
        <li><a href="javascript:;">首页管理</a></li>
        <li><a data-url="/indexCase/admin/list">首页案例更换</a></li>
        <li class="active">添加首页案例</li>
    </ol>
</div>
<form class="form-horizontal" method="post" enctype="multipart/form-data" action="/indexCase/admin/submit">
    <div class="form-group">
        <label for="inputTitle1" class="col-sm-2 control-label">主题ID</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" name="tid" id="inputTitle1" placeholder="主题唯一ID" >
        </div>

    </div>
    <div class="form-group">
        <label for="inputTitle" class="col-sm-2 control-label">主题名称</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" name="title" id="inputTitle" placeholder="主题名称" >
        </div>

    </div>
    <div class="form-group">
        <label for="inputDownload" class="col-sm-2 control-label">下载量</label>
        <div class="col-sm-4">
            <input type="text" class="form-control" id="inputDownload" name="down" placeholder="下载量" maxlength="5">
        </div>

    </div>


    <div class="form-group">
        <label for="inputFile1" class="col-sm-2 control-label">案例主题图片</label>
        <div class="col-sm-10">
            <input type="file" id="inputFile1" name="images" class="hidden">
            <a class="btn btn-info banner_img text_img2"><span class="glyphicon glyphicon-picture"></span> 添加图片</a>
        </div>
        <div class="col-sm-10 second_img col-sm-offset-2" style="margin-top: 20px;">
            <img src="" alt="" class="" width="180px" height="200px">
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="button" class="btn btn-default submit">确定</button>
        </div>
    </div>
</form>
<script src="/sources/dist/js/jquery.form.js"></script>
<script src="/sources/dist/js/submitForm.js"></script>
<script>

    $(document).ready(function () {
        $('.breadcrumb a').click(function () {
            if ($(this).attr('data-url')) {
                $('.content_right').load($(this).attr('data-url'));
                operate_btn();
            }
        });
        $('.second_img').hide();
        $('.text_img2').click(function () {
            $('#inputFile1').trigger('click');
        });
        $('#inputFile1').change(function (e) {
            img_show($(this), $('.second_img img'));
            $('.second_img').show();
        });

        function img_show(obj, img_class) {
            var reader = new FileReader();
            var files = obj[0].files[0];
            reader.onload = function (e) {
                var imgFile = e.target.result;
                img_class.attr('src', imgFile);
            };
            reader.readAsDataURL(files);
        }
    });

</script>
</body>
</html>
